﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using System.Configuration;
using System.Data.SqlClient;

namespace Gx.Common
{
    public sealed class ConfigHelper
    {


        public static string ConnectionStrings = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

        /// <summary>
        /// cookie密码
        /// </summary>
        public static string SecretKey = ConfigHelper.GetWebConfig("SecretKey");
        public static string CookieSecretKey = ConfigHelper.GetWebConfig("CookieSecretKey");
        /// <summary>
        /// 根据WebConfig里面的Key得到Value
        /// </summary>
        /// <param name="key">键</param>
        /// <returns></returns>
        public static string GetWebConfig(string key)
        {
            return ConfigurationManager.AppSettings[key];
        }

        public static SqlConnection Open(string connString)
        {
            SqlConnection conn = new SqlConnection(connString);
            conn.Open();
            return conn;
        }
    }
}